home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / win_nt95 / cm95-10.zip / FRANINTL.TS < prev    next >
Text File  |  1996-10-29  |  7KB  |  230 lines

  1. ;****************************************************************************
  2. ; ClockMan95 Automation Assistant support file - TAPCIS script
  3. ; (c) 1995 Graphical Dynamics, Inc. The "Common helper functions" are placed
  4. ; in the public domain; otherwise permission is granted to use/modify this
  5. ; script file as long as it's not for resale.
  6. ;
  7. ; Written by: Jennifer Palonus
  8. ;
  9. ; Date    Who   Major changes
  10. ;-------  ---   -------------------------------------------------------------
  11. ;20nov95  jlp   Created.
  12. ;22nov95
  13. ;****************************************************************************
  14.  
  15. [*About this script*]
  16. Gets the latest "Le point sur l'actualite internationale" from The AP-France.
  17. This is updated throughout the day.
  18.  
  19. [*Script Setup*]
  20. Title=Le point sur l'actualite internationale
  21.  
  22. ;****************************************************************************
  23. ; Main processing section.
  24. ;****************************************************************************
  25.  
  26. [*MenuItems*]
  27. text=l'actualite internationale
  28.  
  29.  
  30. [Begin]
  31.     set @Timeout# 120
  32.     let ServiceName$    = "CIS:APFRANCE"
  33.     let ServiceHasHdr    = @TRUE
  34.     let SubjectLine$    = "Le point sur l'actualite internationale"
  35.     let Prompt$            = "^J!"
  36.     gosub "GoService"
  37.     if (OK = @FALSE) fail
  38.  
  39.     ForEach in MenuItems[] gosub "HandleMenu"
  40.     if (HMTFound = @FALSE) end
  41.  
  42.     gosub "CaptureMsg"
  43.     end
  44.  
  45.  
  46. ;****************************************************************************
  47. ; Common helper functions. (These are placed in the "public domain" by GDI.)
  48. ;****************************************************************************
  49. ; [GoService]
  50. ;
  51. ; Carries out a GO command & passes over the introductory text (if any).
  52. ; When this returns, you're ready to capture or parse the service's top menu.
  53. ;
  54. ; ServiceName$        The CIS service you want to GO to.
  55. ; ServiceHasHdr        Does this service have an intro paragraph ending with a
  56. ;                    "MORE !" prompt?
  57. ;****************************************************************************
  58. [GoService]
  59.     let OK = @TRUE
  60.     send "GO " ServiceName$
  61.  
  62.     if (ServiceHasHdr = @FALSE) return
  63.     let Prompt$ = "^JMORE !"         
  64.     gosub "WaitForPrompt"
  65.     send ""
  66.     return
  67.  
  68.     
  69. ;****************************************************************************
  70. ; [HandleMenu]
  71. ;
  72. ; Traverses the tree of menus until you're ready to capture a particular
  73. ; article. To call this function, declare an array section (ex.: [*Menus*])
  74. ; with menu item text and/or item numbers to look for, in either of these forms:
  75. ;     text=<text in menu item>
  76. ;     item=<menu item's number>
  77. ;     
  78. ; Then, call this function in a ForEach stmt: ForEach in Menus[] gosub "HandleMenu"
  79. ;
  80. ; SubjectLine$        The generated mail message's subject line.
  81. ; Prompt$            The prompt that ends the article. Usu. "^J!".
  82. ;
  83. ; Upon return, OK is @TRUE or @FALSE depending on whether any matching items
  84. ; were found. If @TRUE then MenuItem$ is also set to the matching item #
  85. ; & caller is ready to capture or parse the selected article/submenu.
  86. ;****************************************************************************
  87. [HandleMenu]
  88.     let HMTFound = @FALSE
  89.     ;Dispatch to HMText or HMItem, depending on how to choose menu item (by
  90.     ;"Text" or menu "Item" #)...
  91.     goto "HM" @arrItem$
  92.     ;else bad menu cmd...
  93.          Echo "Unrecognized menu item search type '" @arrItem$ "' in [HandleMenu]"
  94.         fail
  95.  
  96. [HMText]
  97.     let HMSearchText$ = @arrValue$
  98.  
  99. ;1 or more menu sections. If >1, they're separated by "MORE !" prompts...
  100. [HMTLoop]
  101.     waitlist
  102.         1 = "^JMORE !"
  103.         2 = "^J!"
  104.     endlist
  105.     DoWaitMenu TheMenuLines[]
  106.     if (@waitMatch# = 0) goto "HMTNoMatchTimeout"
  107.  
  108.     ForEach in TheMenuLines[] gosub "HMTSelectItem"
  109.     if (HMTFound = @TRUE) return
  110.  
  111. [HMTNoMatch]
  112.     if (@waitMatch# = 1) goto "HMTNoMatchMore"
  113.     if (@waitMatch# = 2) goto "HMTNoMatchEOM"
  114.  
  115. [HMTNoMatchTimeout]
  116.     Echo "Timed out waiting for full menu"
  117.     fail
  118.  
  119. [HMTNoMatchMore]
  120.     send ""
  121.     goto "HMTLoop"
  122.  
  123. [HMTNoMatchEOM]
  124.     return
  125.  
  126.  
  127. [HMTSelectItem]
  128.     if (HMTFound = @TRUE) return
  129.  
  130.     if (@strstr (@arrValue$, HMSearchText$) = @FALSE) return
  131.     let HMTFound = @TRUE
  132.     Echo "We found '" HMSearchText$ "': #" @arrItem$ " = '" @arrValue$ "'!"
  133.     
  134.     send @arrItem$
  135.     return
  136.  
  137.  
  138. [HMItem]
  139.     let OK = @TRUE
  140.     let Prompt$ = ""
  141.     gosub "WaitForPrompt"
  142.  
  143.     send @arrValue$
  144.     return
  145.  
  146.     
  147. ;****************************************************************************
  148. ; [ChooseMenuItem]
  149. ;
  150. ; Selects an article from a menu by item #. Upon return, you're ready to
  151. ; CaptureMsg it.
  152. ;
  153. ; MenuItem$            The menu selection #.
  154. ; SubjectLine$        The generated mail message's subject line if different
  155. ;                    than the default.
  156. ; Prompt$            The prompt that ends the article. Usu. "^J!".
  157. ;****************************************************************************
  158. [ChooseMenuItem]
  159.     let OK = @TRUE
  160.     let Prompt$ = "^J!"
  161.     gosub "WaitForPrompt"
  162.  
  163.     send MenuItem$
  164.     return
  165.  
  166.  
  167. ;****************************************************************************
  168. ; [CaptureMsg]
  169. ;
  170. ; Assuming CIS is about to send us the text that we want to place into a mail
  171. ; message, this routine captures the text 'till we get a <CR> & ! prompt.
  172. ;
  173. ; SubjectLine$        The custom subject line if different than the default.
  174. ; Prompt$            The prompt that ends the article. Usu. "^J!".
  175. ;****************************************************************************
  176. [CaptureMsg]
  177.     if (@capName$ = "") let @capName$ = @pathMsg$ @svcName$ '.MSG'
  178.     let @hdrSub$ = SubjectLine$
  179.     Echo "Capturing article to " @capName$
  180.     CapHeader
  181.  
  182.     let OK = @TRUE
  183.  
  184.     let Prompt$ = "^J!"
  185.     gosub "WaitForPrompt"
  186.     CapClose
  187.  
  188.     let SubjectLine$ = ""
  189.     return
  190.  
  191.  
  192. ;****************************************************************************
  193. ; [WaitForPrompt]
  194. ;
  195. ; Wait till the end of a menu or opening text. This routine handles menus
  196. ; split up into multiple chunks, each of which end in "MORE !" prompts.
  197. ; If you DO want to wait for "MORE !", then set Prompt$ to it.
  198. ;
  199. ; Prompt$            The prompt you're waiting for. Usu. "^J!".
  200. ;****************************************************************************
  201. [WaitForPrompt]
  202.     let OK = @TRUE
  203.     if (Prompt$ = "") let Prompt$ = "^J!"
  204.  
  205. [WFPLoop]
  206.     waitlist
  207.         1 = Prompt$
  208.         2 = "^JMORE !"
  209.         3 = "^J!"
  210.     endlist
  211.     DoWaitMenu TheMenuLines[]
  212.     if (@waitMatch# = 1) return
  213.     if (@waitMatch# = 2) goto "WFPMore"
  214.     if (@waitMatch# = 3) return
  215.  
  216.     ; else...
  217.     let OK = @FALSE
  218.     Echo "...timed out waiting for a prompt"
  219.     return
  220.  
  221. [WFPMore]
  222.     Send ""
  223.     goto "WFPLoop"
  224.  
  225.  
  226. ;****************************************************************************
  227. [HandleErrors]
  228.     fail
  229.  
  230.